/*
 * BinaryTree.h
 *
 *  Created on: April 22, 2013
 *      Author: Anthony Varghese
 */

#ifndef BINARYTREE_H_
#define BINARYTREE_H_

#include <cstddef>

namespace assignment4 {

class BinaryTree {
private:
	class Node{
	public:
		Node(int d): data(d), left(NULL), right(NULL){ }
		int data;
		Node* left;
		Node* right;
	};
public:
	BinaryTree();
	virtual ~BinaryTree();
	void add(int d);
	friend std::ostream& operator <<( std::ostream& o, BinaryTree& t);
private:
	Node* root;
	void add_inorder(Node* t, int d);
	void print_inorder(std::ostream& o, Node*t);
	void print_preorder(std::ostream& o, Node*t);
	void print_postorder(std::ostream& o, Node*t);
};

} /* namespace assignment4 */
#endif /* BINARYTREE_H_ */
